package com.wei;

/**
 * @Author :sunwei
 * @Description:
 * @Date create in 21:34  2021/4/14
 * @Modified by:
 */
public class SystemGCTest {
    public void GCTest01() {
        byte[] bytes = new byte[5 * 1024 * 1024];
        System.gc();

    }

    public void GCTest02() {
        byte[] bytes = new byte[5 * 1024 * 1024];
        bytes = null;
        System.gc();
    }

    public void GCTest03() {
        {
            byte[] bytes = new byte[5 * 1024 * 1024];
        }
        System.gc();
    }

    public void GCTest04() {
        {
            byte[] bytes = new byte[5 * 1024 * 1024];
        }
        int value = 1;
        System.gc();
    }

    public void GCTest05() {
        GCTest01();
        System.gc();
    }

    public static void main(String[] args) {
        SystemGCTest test = new SystemGCTest();
//        test.GCTest01();
//        test.GCTest02();
//        test.GCTest03();
//        test.GCTest04();
        test.GCTest05();
    }
}
